<?php
class AddComment{
	public function __construct($uid,$tid,$content,$public){  
		$link = new ConnData();
		$sql="insert into comments(uid,tid,content,public) values(".$uid.",'".$tid."','".$content."','".$public."')";
		$result = mysqli_query($link->conn,$sql);
		if($result === false){
    		echo $link->conn->error;
    		echo $link->conn->errno;
		}
		$this->addFocus($tid);
	}

	private function addFocus($tid){  
		$sql=	"update themes set focus=1 where tid=".$tid;
		$result = mysqli_query($link->conn,$sql);
		if($result === false){
    		echo $link->conn->error;
    		echo $link->conn->errno;
		}
	}
		
}
?>